#include "stdio.h"
main()
{	   	   	     	 
    float a, x, x0;
    int i = 0;
    do
    {	   	   	     	 
        printf("Input a=? ");
        scanf("%f", &a);
    }
    while (a < 0);
    x = a;// / 4;
    do
    {	   	   	     	 
        i++;
        x0 = x;
        x = (x0 + a / x0) / 2;
    }
    while (i < 20 && (x - x0 >= 1.e-5 || x - x0 <= -1.e-5));
    printf("\na=%.6f,x=%.6f,i=%d", a, x, i);
}